package com.catfive.jet_work.feature.empty

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.CenterAlignedTopAppBar
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.hilt.navigation.compose.hiltViewModel
import com.catfive.jet_work.R
import com.catfive.jet_work.feature.switchpanel.SWITCH_PANEL_ROUTE
import com.catfive.jet_work.viewmodel.NavigationViewModel

@Composable
fun EmptyRoute(
    goSelectPanel: (route: String) -> Unit
) {
    EmptyScreen(goSelectPanel = goSelectPanel)
}


@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun EmptyScreen(
    goSelectPanel: (route: String) -> Unit,
) {
    Scaffold(topBar = {
        CenterAlignedTopAppBar(
            colors = TopAppBarDefaults.topAppBarColors(
                containerColor = MaterialTheme.colorScheme.surfaceVariant.copy(0.6f)
            ),
            title = {
                Text(
                    text = "开始摸鱼", fontSize = 20.sp
                )
            }
        )
    }
    ) { paddingValues ->
        Surface(modifier = Modifier.padding(paddingValues)) {
            Column(
                modifier = Modifier
                    .fillMaxSize()
                    .padding(bottom = 120.dp),
                verticalArrangement = Arrangement.Center,
                horizontalAlignment = Alignment.CenterHorizontally
            ) {
                Image(
                    modifier = Modifier,
                    painter = painterResource(R.drawable.bg_no_documents),
                    contentDescription = ""
                )

                Text(

                    fontSize = 20.sp,
                    text = stringResource(R.string.empty_panel),
                    color = colorResource(R.color.empty_title)
                )

                Text(
                    modifier = Modifier.padding(top = 10.dp, bottom = 20.dp),
                    fontSize = 18.sp,
                    text = stringResource(R.string.empty_info),
                    color = colorResource(R.color.empty_info)
                )

                Button(
                    modifier = Modifier
                        .fillMaxWidth(.7f)
                        .padding(top = 80.dp),
                    onClick = {
                        goSelectPanel(SWITCH_PANEL_ROUTE)
                    }
                ) {
                    Text(text = stringResource(R.string.empty_select), fontSize = 18.sp)
                }
            }
        }
    }

}